package com.example.demo.service.impl.muban;

import com.alibaba.fastjson.JSON;

import javax.annotation.Resource;

public class TestMain {

    @Resource
    private ItemInfoBlock itemInfoBlock;

    public static void main(String[] args) {
        // 1.模拟获取SpringBean
        ItemInfoBlock itemInfoBlock = new ItemInfoBlock();

        // 2. ModelContainer可以理解为贯穿上下文中的请求参数，或者一些组装数据需要的预加载数据
        ModelContainer modelContainer = new ModelContainer();
        // 3. 获取返回结果
        ItemInfoBlock.ItemInfo itemInfo = itemInfoBlock.template(modelContainer);
        System.out.println(JSON.toJSONString(itemInfo));
        // 结果：{"itemId":123,"itemName":"测试"}
    }
}
